var currentImage;
var currentIndex = -1;
var interval;
function showImage(index,title){
	if(index < $('#bigPic img').length){
		var indexImage = $('#bigPic img')[index]
		//var abc = "aaa";$('#bigPic img')[index].attr('titl');
		if(currentImage){   
			if(currentImage != indexImage ){
				$(currentImage).css('z-index',2);
				clearTimeout(myTimer);
				$(currentImage).fadeOut(250, function() {
					myTimer = setTimeout("showNext()", 3000);
					$(this).css({'display':'none','z-index':1})
				});
			}
		}
		$(indexImage).css({'display':'block', 'opacity':1});
		$("#pictitle h3").html(title);
		currentImage = indexImage;
		currentIndex = index;
		$('#thumb li').removeClass('active');
		$($('#thumb li')[index]).addClass('active');
	}
}
function showNext(){
	var len = $('#bigPic img').length;
	var tit = $('#thumb li img').eq(currentIndex+1).attr('title');
	var next = currentIndex < (len-1) ? currentIndex + 1 : 0;
	showImage(next,tit);
}
var myTimer;
$(document).ready(function() {
	myTimer = setTimeout("showNext()", 3000);
	title = $('#thumb li').eq(0).attr('name');
	showNext(title); //loads first image
	$('#thumb li').bind('click',function(e){
		var count = $(this).attr('rel');
		var title = $(this).attr('name');
		showImage(parseInt(count)-1,title);
	});
});
$('#thumb li').css("margin-left","0px");
$(function() {
	$("#bookdate").datepicker({
		minDate: 0
	});
	$("#startdate").datepicker({
		minDate: 0
	});
});